Cannot convert type child to type parent c#

49

Cannot convert type child to type parent c# -

//A simple way to downcast in C# is to json serialize the parent and then deserialize it into the child.

string serializedParent = JsonConvert.SerializeObject(parentInstance); 
 Child c  = JsonConvert.DeserializeObject<Child>(serializedParent);

Comments

Submit
0 Comments